import com.dongrj.framework.starter.sms.SmsRequest;
import com.dongrj.framework.starter.sms.SmsSceneEnum;
import com.dongrj.framework.starter.sms.enums.SmsEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;


@Setter
@Getter
@ToString
public class SmsScene implements Serializable {
    private SmsEnum smsEnum;
    private SmsSceneEnum smsSceneEnum;
    private String templateCode;
    private String templateContent;

    public static SmsScene buildWithCode(SmsEnum smsEnum, SmsSceneEnum smsSceneEnum, String templateCode) {
        SmsScene smsScene = new SmsScene();
        smsScene.setSmsEnum(smsEnum);
        smsScene.setSmsSceneEnum(smsSceneEnum);
        smsScene.setTemplateCode(templateCode);
        return smsScene;
    }

    public static SmsScene buildWithContent(SmsEnum smsEnum, SmsSceneEnum smsSceneEnum, String templateContent) {
        SmsScene smsScene = new SmsScene();
        smsScene.setSmsEnum(smsEnum);
        smsScene.setSmsSceneEnum(smsSceneEnum);
        smsScene.setTemplateContent(templateContent);
        return smsScene;
    }

    public boolean findOne(SmsEnum smsEnum, SmsSceneEnum smsSceneEnum) {
        return this.smsEnum.equals(smsEnum) && this.smsSceneEnum.equals(smsSceneEnum);
    }

    public SmsRequest buildRequest() {
        SmsRequest smsRequest = new SmsRequest();
        smsRequest.setTemplateCode(templateCode);
        smsRequest.setContent(templateContent);
        return smsRequest;
    }
}